package com.example.demo.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author twj
 * @description TODO
 * @time 2023/8/11^16:00:49
 */
@RestController
public class HelloController {
    @RequestMapping("/hello")
    @PreAuthorize("@ex.hasAuthority('system:dept:list')") //通过SPEL表达式调用指定bean中的方法，ex是bean的名字
    //@PreAuthorize("hasAnyAuthority('system:dept:delete','system:dept:list')")
    //@PreAuthorize("hasRole('system:dept:list')")
    //@PreAuthorize("hasAnyRole('system:dept:delete','system:dept:list')")
    public String hello(){
        return "hello";
    }
}
